<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>材料供应需求统计</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../resources/css/style.css" media="all">
    <style>
        .layui-form-label{width: 100px; height: 20px;}
        .layui-form-select{width: 190px;}
        #gonghuoshijian{ width: 100%;}
        .addUser input{width: 86%;}
        .layui-form-select{width: 100%!important;}
        .layui-form-select input{width: 100%;}
        .layui-form-item{padding-left: 0;}
        .layui-form-item .layui-input-inline{width: 73%!important;}
        .masksx{width: 800px;}
        .material{display: flex;justify-content: flex-start;padding-left: 15px;padding-right: 77px;margin-bottom: 8px;width: 100%;margin-left: 55px;}
        .material label{float: left;height: 38px;line-height: 38px; display: inline-block;}
        ._mater{width: 49%;margin-left: 30px;}
        .layui-form-select .layui-input{padding-right: 0;}
        ._materwarp{width: 43%;}
        .masksx .forms{padding: 0;}
        .material ._mater_input{width: 10%;}
        ._mater_lab{margin:0 20px;}
        .addTo{background-color: #86B1FC;color: #FFF; width: 10px;height: 10px;display: none}
        .materialone .addTo{display:inline;}
        .mater_btn{margin: 6px 0 0 6px;}
        .material_C{width: 100px;text-align: justify;}
        .material_C:after{content:'';width: 100%;display: inline-block;}
        .materialone .mater_btn{display: none;}
        .layui-form-selectup dl{top: -184px;}
        @media screen and (max-width: 750px){
            .MOVE_queryon .layui-form-item {
                width: 80%;
            }
            .layui-form-item{padding: 0;}
            .MOVE_footer{text-align: right;}
            .MOVE_footer a{color: #FFF;font-size: 20px;line-height: 30px;
                padding: 10px;background-color: #F5A721;height: 100%;position: absolute;right: 0;}
        }
        .layui-form-pane .layui-input-inline{width: 80%;}
        .titles{text-align: center;margin: 0;font-size: 20px;}
        .xuanzhong .layui-input-block{margin-left: 0;}
        .beixuan table th{width: 33.333%;}
        .masksx{height: 550px;}

    </style>
</head>
<body>
<div class="_PC">
    <form class="layui-form layui-form-pane" id="form_7grid" action="" lay-filter="hetong">
        <div class="formTop layui-row">
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-xs3">
                <div class="layui-input-inline" style="width: 80%;">
                    <input type="text" name="username" lay-verify="required" placeholder="项目名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-xs3">
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="test-limit3" placeholder="请输入开始日期">
                    <div class="icons">

                    </div>
                </div>
            </div>
            <div class="layui-inline layui-col-lg3 layui-col-md3 layui-col-xs3">
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="test-limit4" placeholder="请输入结束日期">
                    <div class="icons">

                    </div>
                </div>
            </div>
            <div class="layui-col-lg3 layui-col-md3 layui-col-xs3">
                <button class="layui-btn" type="button"  onclick="query()" tyle="margin-bottom: 10px;">查询</button>
                <button class="layui-btn" type="button" onclick="checkTab()" style="margin-bottom: 10px;">核验表
                </button>
            </div>

        </div>
        <table id="demo" lay-filter="test"></table>
        <script type="text/html" id="barDemo">

            <a class="layui-btn layui-btn-danger layui-btn-sm quanxian" lay-event="look" QX="api/supply/materialGySelList.do">详情</a>

            <!--<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="edit">编辑</a>-->
        </script>
        <!--<script type="text/html" id="titleTpl">-->

        <!--<span>{{times(1510635999999)}}</span>-->

        <!--</script>-->
    </form>
    <div id="demo7"></div>

</div>

<a class="dayin" type="button" id="dlink"  style="float: right; position: fixed; right: 50px; bottom: 50px; z-index: 999;"></a>


<script src="../../../resources/layui/layui.js" charset="utf-8"></script>
<script src="../../../resources/js/style.js"></script>
<script src="../../../resources/js/api.js"></script>
<script>
    function checkTab() {
        layui.use(['form', 'layedit', 'laydate','table','element'], function() {
            var compid =  getCookie('yanzheng').split("|")[1];
            layer.open({
                type: 2,
                title: '核验单',
                maxmin: 'true',
                shadeClose: true,
                area: ['520px', '340px'], //宽高
                shade: 0.8,
                content: urls + '/ureport/preview?_u=file:sup.check.ureport.xml&supCode='+ compid //iframe的url
            });
        });
    }
    function query() {
        layui.use(['form', 'layedit', 'laydate','table','element'], function() {
            var form = layui.form
                , table = layui.table;
            var pronName=$("[name='username']").val();
            var begintime=$('#test-limit3').val();
            var endtime=$('#test-limit4').val();


            if(!AntiSqlValid(pronName)){
                if(lbq('api/supply/materialGySelList.do')) {
                    // 2017-12-25 11:16:37
                    API.cailiaogongyingchaxun({
                        'type': 'a',
                        'mname': pronName,
                        'begintime': begintime,
                        'endtime': endtime,
                        'p': getCookie('yanzheng')
                    })
                }
            }else {
                layer.msg('请勿输入特殊符号');
            };
        })

    }


    layui.use(['form', 'layedit', 'laydate','table','element','laypage','flow'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table=layui.table
            ,laypage=layui.laypage
            ,flow=layui.flow
            ,element=layui.element;
        jiazais();

        laydate.render({
            elem: '#gonghuoshijian' //指定元素
            ,type: 'datetime'
        });

        $(document).on('click','.mater_btn',function () {
            $(this).parent().remove();
        })

        $('.close').click(function () {     //遮罩层隐藏
            $('.mask').hide();
        });
        dayintishi('.dayin');


        //日期控件
        laydate.render({
            elem: '#date'
            ,type: 'datetime'
        });
        laydate.render({
            elem: '#date1'
            ,type: 'datetime'
        });

        //执行渲染
        if(lbq('api/supply/materialGySelList.do')){
            API.cailiaogongyingchaxun({'type':'a','p':getCookie('yanzheng')});

        }


        //前后若干天可选，这里设置不能选过去的日期      最远可选1000天之后
        panduanshijiantow('#test-limit3','#test-limit4',1000,1000,'.layui-btn-normal');     //查询 开始结束时间判断




        //监听工具条
        table.on('tool(test)', function(obj){ //注<span class="maohao">：</span>tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象

            if(layEvent === 'shenqing'){ //发货
                //do somehing

            }else if(layEvent==='look'){
                //console.log(obj)
                sessionStorage.rm_Code=obj.data.rm_Code;
                sessionStorage.zhuangtai=obj.data.validate;
                location.href='./cailiaoxiangqing.html';


            }
        });

        inputs();




    })

</script>
</body>
</html>